// import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import MainView from '../views/MainView.vue'

const router = createRouter({
  history: createWebHashHistory( import.meta.env.BASE_URL ),
  // history: createWebHistory( import.meta.env.BASE_URL ),
  routes: [
    {
      path: '/',
      redirect:{name:'login'}
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView
    },
    {
      path: '/store',
      name: '店铺',
      component: () => import('../views/StoreView.vue')
    },
    {
      path: '/main',
      name: 'main',
      component: MainView,
      children:[
        { name:'综合', path: 'home', component: HomeView },
        { name:'产品列表', path: 'product/list', component: () => import('../components/Product/List.vue') },
        { name:'产品编辑', path: 'product/edit/:id', component: () => import('../components/Product/Edit.vue') },
        { name:'产品创建', path: 'product/create', component: () => import('../components/Product/Edit.vue') },
        // { name:'产品分类', path: 'product/category', component: () => import('../components/Product/category.vue') },
        { name:'产品分类', path: 'category/list', component: () => import('../components/Category/List.vue') },
        { name:'产品分类编辑', path: 'category/edit/:id', component: () => import('../components/Category/Edit.vue') },
        { name:'产品分类创建', path: 'category/create', component: () => import('../components/Category/Edit.vue') },
        { name:'产品评论', path: 'comment/list', component: () => import('../components/Comment/List.vue') },
        { name:'产品评论编辑', path: 'comment/edit/:id', component: () => import('../components/Comment/Edit.vue') },
        { name:'产品评论创建', path: 'comment/create', component: () => import('../components/Comment/Edit.vue') },
        { name:'品牌列表', path: 'brand/list', component: () => import('../components/Brand/List.vue') },
        { name:'品牌编辑', path: 'brand/edit/:id', component: () => import('../components/Brand/Edit.vue') },
        { name:'品牌创建', path: 'brand/create', component: () => import('../components/Brand/Edit.vue') },
        { name:'订单列表', path: 'order/list', component: () => import('../components/Order/List.vue') },
        { name:'订单编辑', path: 'order/edit/:id', component: () => import('../components/Order/Edit.vue') },
        { name:'客户列表', path: 'customer/list', component: () => import('../components/Customer/List.vue') },
        { name:'客户编辑', path: 'customer/edit/:id', component: () => import('../components/Customer/Edit.vue') },
        { name:'客户群组列表', path: 'customer/group/list', component: () => import('../components/Customer/GroupList.vue') },
        { name:'客户群组编辑', path: 'customer/group/edit/:id', component: () => import('../components/Customer/GroupEdit.vue') },
        { name:'客户群组创建', path: 'customer/group/create', component: () => import('../components/Customer/GroupEdit.vue') },
        { name:'店铺设置', path: 'settings/store', component: () => import('../components/Settings/Store.vue') },
        { name:'修改密码', path: 'settings/password', component: () => import('../components/Settings/Password.vue') },
        { name:'横幅设置', path: 'design/banner', component: () => import('../components/Design/Banner/List.vue') },
        { name:'横幅编辑', path: 'design/banner/edit/:id', component: () => import('../components/Design/Banner/Edit.vue') },
        { name:'横幅添加', path: 'design/banner/create', component: () => import('../components/Design/Banner/Edit.vue') },
        { name:'用户中心', path: 'design/customer', component: () => import('../components/Design/Customer.vue') },
        // { name:'推荐产品', path: 'design/product', component: () => import('../components/Design/Customer.vue') },
        // { name:'推荐分类', path: 'design/category', component: () => import('../components/Design/Customer.vue') },
        { name:'模块列表', path: 'design/module', component: () => import('../components/Design/Module/List.vue') },
        { name:'模块详情', path: 'design/module/:id', component: () => import('../components/Design/Module/Edit.vue') },
        
        { name:'PC页面DIY', path: 'design/diy', component: () => import('../components/Design/DIY/List.vue') },
        { name:'PC页面DIY-编辑', path: 'design/diy/:id', component: () => import('../components/Design/DIY/Edit.vue') },
        { name:'PC页面DIY-创建', path: 'design/diy/add', component: () => import('../components/Design/DIY/Edit.vue') },
        { name:'移动端DIY', path: 'design/mobile/diy', component: () => import('../components/Design/DIY/Mobile/List.vue') },
        { name:'移动端DIY-编辑', path: 'design/mobile/diy/:id', component: () => import('../components/Design/DIY/Mobile/Edit.vue') },
        { name:'移动端DIY-创建', path: 'design/mobile/diy/add', component: () => import('../components/Design/DIY/Mobile/Edit.vue') },

        { name:'CMS-导航列表', path: 'cms/nav', component: () => import('../components/CMS/Nav/List.vue') },
        { name:'CMS-导航编辑', path: 'cms/nav/edit/:id', component: () => import('../components/CMS/Nav/Edit.vue') },
        { name:'CMS-导航创建', path: 'cms/nav/create', component: () => import('../components/CMS/Nav/Edit.vue') },
        { name:'CMS-子导航创建', path: 'cms/nav/create/:parent_id', component: () => import('../components/CMS/Nav/Edit.vue') },
        
        { name:'CMS-轮播列表', path: 'cms/lunbo', component: () => import('../components/CMS/Lunbo/List.vue') },
        { name:'CMS-轮播编辑', path: 'cms/lunbo/edit/:id', component: () => import('../components/CMS/Lunbo/Edit.vue') },
        { name:'CMS-轮播创建', path: 'cms/lunbo/create', component: () => import('../components/CMS/Lunbo/Edit.vue') },
        
        { name:'CMS-内容分类列表', path: 'cms/category', component: () => import('../components/CMS/Category/List.vue') },
        { name:'CMS-内容分类创建', path: 'cms/category/create', component: () => import('../components/CMS/Category/Edit.vue') },
        { name:'CMS-内容子分类创建', path: 'cms/category/create/:parent_id', component: () => import('../components/CMS/Category/Edit.vue') },
        { name:'CMS-内容分类编辑', path: 'cms/category/edit/:id', component: () => import('../components/CMS/Category/Edit.vue') },
        { name:'CMS-内容详情列表', path: 'cms/article', component: () => import('../components/CMS/Article/List.vue') },
        { name:'CMS-内容详情创建', path: 'cms/article/create', component: () => import('../components/CMS/Article/Edit.vue') },
        { name:'CMS-内容详情编辑', path: 'cms/article/edit/:id', component: () => import('../components/CMS/Article/Edit.vue') },
        
      ]
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },

  ]
})

export default router
